import request from 'request'
// 获取
export function getPermissions () {
  return request({
    url: '/sys/permission'
  })
}
// 新增权限
export function addPermission (data) {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

// 删除权限
export function delPermission (id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

// 获取权限详情
export function getPermissionDetail (id) {
  return request({
    url: `/sys/permission/${id}`
  })
}

// 更新权限
export function updatePermission (id, data) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'put',
    data
  })
}
// 给角色分配权限 {id:角色id, permIds:[] 所有选中的节点的id组成的数组}
export function assignPerm (data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
export function getRoleDetailById (id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'GET'
  })
}
